#include <algorithm>
#include <cstdio>
using namespace std;
typedef long long ll;
ll mod = 0, n, l, m;
ll pow(ll x, ll d) {
	ll res = 1;
	while (x) {
		if (x & 1) {
			x -= 1;
			res *= d;
			res %= mod;
		}
		x >>= 1;
		d = d * d % mod;
	}
	return res;
}
pair< ll, ll > exgcd(ll a, ll b) {
	if (b == 0) {
		return make_pair(1, 0);
	}
	pair< ll, ll > tmp = exgcd(b, a % b);
	return make_pair(tmp.second, tmp.first - (a / b) * tmp.second);
}

int main() {
	freopen("card.in", "r", stdin);
	freopen("card.out", "w", stdout);
	scanf("%lld %lld %lld", &n, &m, &l);
	mod = n + 1;
	ll inv = exgcd(pow(m, 2), mod).first;
	printf("%lld", ((l * inv % mod) + mod) % mod);
	return 0;
}